package main

import "gitee.com/dreamwood/ez-maker/maker"

func Process() {
	c := maker.CreateTable("Process", "工序", "produce")
	c.AddName()
	c.LoadTree()
	c.AddManyToOne("cat", "工序类型", "ProcessCategory").SetDesc("1通用工序，2产品工序")
	c.Generate()
}

func ProcessCategory() {
	c := maker.CreateTable("ProcessCategory", "工序类型", "produce")
	c.AddName()
	c.AddSort()
	c.Generate()
}

func Routing() {
	c := maker.CreateTable("Routing", "工艺设计", "produce")
	c.AddName()
	c.AddOneToMany("lines", "线路", "RoutingLine")
	c.Generate()
}

func RoutingLine() {
	c := maker.CreateTable("RoutingLine", "工艺线路", "produce")
	c.AddName()
	c.AddManyToOne("routing", "所属工艺", "Routing")
	c.AddOneToMany("items", "节点", "RoutingItem").SetFk("line_id")
	c.AddBool("isMain", "是否主线")
	c.AddSort()
	c.Generate()
}
func RoutingItem() {
	c := maker.CreateTable("RoutingItem", "工艺节点", "produce")
	c.AddManyToOne("line", "所属线路", "RoutingLine")
	c.AddName()
	c.AddInt("step", "步骤")

	//节点跳转
	//--默认下一个节点
	//--满足指定条件组中的一项
	c.AddManyToMany("conditions", "条件跳转", "RoutingItemCondition")

	c.Generate()
}

func RoutingItemCondition() {
	c := maker.CreateTable("RoutingItemCondition", "切线条件", "produce")
	c.AddName()
	c.AddInt("checkId", "ID检查")
	c.AddText("checkString", "文本检查")
	c.AddText("flag", "标记").SetDesc("产出类型f1，质量原因f2，管理干预f3")
	c.AddInt("to", "目标节点")
	c.Generate()
}
